package edu.Pta;
//然后是几点

import java.util.Scanner;

public class ptaDemo3 {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int numTime = input.nextInt();
        int numIncrement = input.nextInt();
        input.nextLine();
        input.close();

        int numHour = numTime / 100;
        int numMinute = numTime % 100;
        numIncrement += numMinute;
        numHour += numIncrement / 60;

        int result = numHour * 100 + numIncrement % 60;

        System.out.println(result);
    }
}
    /*public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int a = input.nextInt();
        int b = input.nextInt();
        int c = a / 100;
        int d = a % 100;
        int e = c * 60 + b + d;
        int f = e / 60;
        int s = e % 60;
        System.out.println(f*100 + s);*/
